﻿<?php

/* @var $this \yii\web\View */
/* @var $content string */

use backend\assets\AppAsset;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use common\widgets\Alert;
use common\models\System;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<?php
$name = System::find()->where(['type'=>'系统名'])->one();
?>
<div class="wrap">
    <?php
    NavBar::begin([
        'brandLabel' => $name->name,
        'brandUrl' => Yii::$app->homeUrl,
        'options' => [
            'class' => 'navbar-inverse navbar-fixed-top',
        ],
    ]);
    $menuItems = [
        ['label' => '首页搜索', 'url' => ['/post/index']],
        ['label' => '新闻动态', 'url' => ['/post/news']],
        ['label' => '所有文章', 'url' => ['/post/allpost']],
        ['label' => '成绩查询', 'url' => ['/achievement/index']],

    ];
    if (Yii::$app->user->isGuest) {
        $menuItems[] = ['label' => '登陆', 'url' => ['/site/login']];
    } else {
        $menuItems[] = ['label' => '成绩录入', 'url' => ['/achievement/create']];
        $menuItems[] = ['label' => '后台管理', 'url' => ['/post/admin']];
        $menuItems[] = '<li>'
            . Html::beginForm(['/site/logout'], 'post')
            . Html::submitButton(
                 Yii::$app->user->identity->username .' | 退出',
                ['class' => 'btn btn-link logout']
            )
            . Html::endForm()
            . '</li>';
    }
    echo Nav::widget([
        'options' => ['class' => 'navbar-nav navbar-right'],
        'items' => $menuItems,
    ]);
    NavBar::end();
    ?>

    <div class="container">
        <?= Alert::widget() ?>
        <?= $content ?>
    </div>
</div>

<section id="footer">
    <div class="container">
        <div class="row">
            <div class="col-md-6 col-md-offset-3">
                <div id="footer-content">
                    <p>
                        <a href="http://www.qiwangxiao.com/index.html">官网</a>
                        <a href="http://www.qiwangxiao.com/products/onlineService.html">产品</a>
                        <a href="http://www.qiwangxiao.com/agent.html">代理</a>
                        <a id="wx-public">公众号</a>
                        <a href="http://www.qiwangxiao.com/about.html">关于</a>
                    </p>
                    <p>成都奇网校科技有限公司版权所有丨蜀ICP备12014756号丨版本1.0.0</p>
                </div>
            </div>
        </div>
    </div>
</section>
<?= Html::jsFile('@web/assets/jquery/jquery-3.2.1.min.js')?>
<script>
    $(function() {
        $('#wx-public').popover({
            trigger: 'hover',//鼠标以上时触发弹出提示框
            html: true,//开启html 为true的话，data-content里就能放html代码了
            content: "<img id='wx-public-img' src='http://www.qiwangxiao.com/images/about/weixin.jpg'>",
            placement: 'top'
        });
    });
</script>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
